package cn.bdqn.service.impl;

import cn.bdqn.mapper.RptMapper;
import cn.bdqn.service.RptService;
import cn.bdqn.vo.ConsRptVo;
import cn.bdqn.vo.ContrRptVo;
import cn.bdqn.vo.SvrRptVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class RptServiceImpl implements RptService {
    @Resource
    private RptMapper rptMapper;
    @Override
    public IPage<ContrRptVo> getContrRptVosByPage(String custName, Integer
            pageNo,
                                                  Integer pageSize) {
        //组装分页条件
        Page<ContrRptVo> page=new Page<>(pageNo,pageSize);
        //组装过滤条件
        Map<String,Object> map=new HashMap<>();
        map.put("custName",custName);
        //调用分页方法
        IPage<ContrRptVo>
                contrRptVoPage=rptMapper.getContrRptVosByPage(page,map);
        //返回分页对象
        return contrRptVoPage;
    }
    @Override
    public List<ContrRptVo> getContrRptVos() {
        //调用方法
        List<ContrRptVo> list=rptMapper.getContrRptVos();
        //返回对象
        return list;
    }

    @Override
    public IPage<ConsRptVo> getConsRptVosByPage(String dictType, Integer pageNo,
                                                Integer pageSize) {
        //组装分页条件
        Page<ConsRptVo> page=new Page<>(pageNo,pageSize);
        //组装过滤条件
        Map<String,Object> param=new HashMap<>();
        param.put("dictType",dictType);
        //调用分页方法
        IPage<ConsRptVo> consRptVoPage = rptMapper.getConsRptVosByPage(page,param);
        //返回分页对象
        return consRptVoPage;
    }

    @Override
    public List<ConsRptVo> getConsRptVos(String dictType) {
        //组装过滤条件
        Map<String,Object> map=new HashMap<>();
        map.put("dictType",dictType);
        //调用方法
        List<ConsRptVo> list = rptMapper.getConsRptVos(map);
        //返回对象
        return list;
    }

    @Override
    public IPage<SvrRptVo> getSvrRptVosByPage(String dictType, Integer pageNo,
                                              Integer pageSize) {
        //组装分页条件
        Page<SvrRptVo> page=new Page<>(pageNo,pageSize);
        //组装过滤条件
        Map<String,Object> map=new HashMap<>();
        map.put("dictType",dictType);
        //调用分页方法
        IPage<SvrRptVo> svrRptVoPage = rptMapper.getSvrRptVosByPage(page,map);
        //返回分页对象
        return svrRptVoPage;
    }
    @Override
    public List<SvrRptVo> getSvrRptVos(String dictType) {
        //组装过滤条件
        Map<String,Object> map=new HashMap<>();
        map.put("dictType",dictType);
        //调用方法
        List<SvrRptVo> list = rptMapper.getSvrRptVos(map);
        //返回对象
        return list;
    }
}
